package cn.wolfcode.controller;

import cn.wolfcode.domain.Result;
import cn.wolfcode.util.OssUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.net.URL;

@Slf4j
@RestController
public class UploadController {
    @Autowired
    private OssUtils ossUtils;
    @PostMapping("/upload")
    public Result upload(MultipartFile image)throws IOException{
        String upload= ossUtils.upload(image);
        return Result.success(upload);
    }

}
